home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / weapons / Mine Drop.lua < prev    next >
Text File  |  2010-07-20  |  2KB  |  49 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Mine Drop
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, July 2010, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.minedrop={}
  10. cc.minedrop.cluster={}
  11.  
  12. -- Load & Prepare Ressources
  13. cc.minedrop.gfx_wpn=loadgfx("weapons/rc.bmp")                            -- Weapon Image
  14. setmidhandle(cc.minedrop.gfx_wpn)
  15. cc.minedrop.gfx_icon=loadgfx("weapons/minedrop.png")                    -- Weapon Icon
  16. setmidhandle(cc.minedrop.gfx_icon)
  17. cc.minedrop.sfx_attack=loadsfx("airstrike.ogg")                            -- Attack Sound
  18.  
  19. --------------------------------------------------------------------------------
  20. -- Weapon: Mine Drop
  21. --------------------------------------------------------------------------------
  22.  
  23. cc.minedrop.id=addweapon("cc.minedrop","Mine Drop",cc.minedrop.gfx_icon,0,2)    -- Add Weapon (0 uses, first in round 2)
  24.  
  25. function cc.minedrop.draw()                                                -- Draw
  26.     setblend(blend_alpha)
  27.     setalpha(1)
  28.     setcolor(255,255,255)
  29.     drawinhand(cc.minedrop.gfx_wpn,7,0)
  30.     -- HUD Positioning
  31.     if weapon_shots==0 then
  32.         hudpositioning(pos_invisible)
  33.     end
  34. end
  35.  
  36. function cc.minedrop.attack(attack)                                        -- Attack
  37.     if (weapon_shots<=0) and (weapon_position==1) then
  38.         -- No more weapon switching!
  39.         useweapon(0)
  40.         playsound(cc.minedrop.sfx_attack)
  41.         weapon_shots=weapon_shots+1
  42.         -- Attack
  43.         for i=-2,2,1 do
  44.             createobject(o_mine,weapon_x+i*40,-100)
  45.         end
  46.         -- End Turn
  47.         endturn()
  48.     end
  49. end